package com.ccsoft.gsms.controller;

import com.ccsoft.gsms.model.ContactType;
import com.ccsoft.gsms.service.ContactTypeService;
import com.ccsoft.gsms.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/contactType")
public class ContactTypeController {

    @Autowired
    private ContactTypeService service;

    @DeleteMapping("/deleteByPrimaryKey/{sid}")
    public JsonResult deleteByPrimaryKey(@PathVariable String sid){
        return JsonResult.ok(service.deleteByPrimaryKey(sid));
    }

    @PostMapping("/insert")
    public JsonResult insert(@RequestBody ContactType record){
        return JsonResult.ok(service.insertSelective(record));
    }

    @GetMapping("/selectByPrimaryKey/{sid}")
    public JsonResult selectByPrimaryKey(@PathVariable String sid){
        return JsonResult.ok(service.selectByPrimaryKey(sid));
    }

    @PutMapping("/updateByPrimaryKey")
    public JsonResult updateByPrimaryKey(@RequestBody ContactType record){
        return JsonResult.ok(service.updateByPrimaryKey(record));
    }

    @GetMapping("/selectAll")
    public JsonResult selectAll(){
        return JsonResult.ok(service.selectAll());
    }
}
